/**
 *    @file       signals.h
 *
 *    @brief      
 *    @details
 *
 *    @version    1.0
 *    @date       02/11/2014 11:25:07 AM
 *
 *    @author     Theophilus (), wangtf418@gmail.com 
 */
#ifndef _BF_SIGNALS_H_
#define _BF_SIGNALS_H_
#include <signal.h>
#include "comdef.h"

class signals
{
public:
	signals();
	~signals();
	
public:
	inline sigset_t & get_sigset()
	{
		return m_sigset;
	}

	inline sigset_t & get_oldmaskset()
	{
		return m_oldmaskset;
	}

public:
	bf_int_t addall();
	bf_int_t add(bf_int_t signum);
	bf_int_t del(bf_int_t signum);
	bf_int_t if_in_set(bf_int_t signum);
	bf_int_t clear();

public:
	bf_int_t set_block_signals();
	bf_int_t add_block_signals();
	bf_int_t del_block_signals();
	bf_int_t recover_block_signals();

public:
	static bf_int_t set_sighandler(bf_int_t signum, sighandler_t handler);
	static bf_int_t set_default_sighandler(bf_int_t signum);
	static bf_int_t ignore_signal(bf_int_t signum);
private:
	sigset_t m_sigset;
	sigset_t m_oldmaskset;
};
#endif

